package cn.sc.allinpay.allfavour.business.setting;

import android.text.TextUtils;

import cn.pai.mvp.presenter.PaiPresenter;
import cn.sc.allinpay.allfavour.app.Constant;
import cn.sc.allinpay.allfavour.business.common.utils.SpUtils;

/**
 * 管理员密码修改 presenter
 * author：pany
 * on 2017/12/1 11:27
 */
public class SettingPresenter extends PaiPresenter<SettingContract.View> implements SettingContract.Presenter {

    private SettingModel model = new SettingModel();
    private String mobileStatus;//

    private String qrStatus;//

    @Override
    public void start() {
        mobileStatus = SpUtils.get(view.getContext(),Constant.SPNAME, Constant.SpKey.MOBILE_STATUS, Constant.MOBILE_STATUS_VOID_DEFAULT);
        if(TextUtils.isEmpty(mobileStatus)) {
            mobileStatus = Constant.MOBILE_STATUS_VOID_DEFAULT;
        }
        view.showMobileStatus(mobileStatus);

        qrStatus = SpUtils.get(view.getContext(),Constant.SPNAME, Constant.SpKey.QR_CODE_STATUS, Constant.QR_CODE_STATUS_VOID_DEFAULT);
        if(TextUtils.isEmpty(qrStatus)) {
            qrStatus = Constant.QR_CODE_STATUS_VOID_DEFAULT;
        }
        view.showQrCodeStatus(qrStatus);
    }

    @Override
    public void saveMobileStatus(String status) {
        SpUtils.put(view.getContext(),Constant.SPNAME, Constant.SpKey.MOBILE_STATUS, status);
    }

    @Override
    public void saveQrCodeStatus(String status) {
        SpUtils.put(view.getContext(),Constant.SPNAME, Constant.SpKey.QR_CODE_STATUS, status);
    }
}
